package com.atzxh.java;

/**
 *
 *
 * @author 小红同学
 * @creat 2021-11-08-20:39
 * @description   实现多线程方式二:  实现 Runnable 接口
 */
class Mthread implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if(i % 2 == 0){
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        }
    }
}


public class ThreadTest1 {
    public static void main(String[] args) {
        Mthread mthread = new Mthread();
        Thread t1 = new Thread(mthread);
        t1.start();

        //再启动一个线程
        Thread t2 = new Thread(mthread);
        t2.start();

    }
}
